![]() |
Kinetis SDK API Reference Manual
1.0.0-beta
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the ADC HAL driver. More...
Functions | |
| adc_status_t | adc_hal_start_calibration (uint32_t instance) |
| Starts the calibration process. More... | |
| static void | adc_hal_end_calibration (uint32_t instance) |
| Ends the calibration process. More... | |
| uint32_t | adc_hal_get_calibration_PG (uint32_t instance) |
| Gets and calculates the plus-side calibration parameter. More... | |
| static void | adc_hal_set_calibration_PG (uint32_t instance, uint32_t val) |
| Sets the plus-side calibration parameter to the ADC instance. More... | |
| uint32_t | adc_hal_get_calibration_MG (uint32_t instance) |
| Gets and calculates the minus-side calibration parameter. More... | |
| static void | adc_hal_set_calibration_MG (uint32_t instance, uint32_t val) |
| Sets the minus-side calibration parameter to the ADC instance. More... | |
| static uint32_t | adc_hal_get_calibration_offset (uint32_t instance) |
| Gets the offset value after the auto-calibration. More... | |
| static void | adc_hal_set_calibration_offset (uint32_t instance, uint32_t value) |
| Sets the offset value for manual calibration. More... | |
| static void | adc_hal_set_clock_source_mode (uint32_t instance, adc_clock_source_mode_t mode) |
| Sets the selection of the clock source. More... | |
| static void | adc_hal_configure_asynchronous_clock (uint32_t instance, bool isEnabled) |
| Switches the asynchronous clock on/off. More... | |
| static void | adc_hal_set_clock_divider_mode (uint32_t instance, adc_clock_divider_mode_t mode) |
| Sets the selection of the clock divider. More... | |
| static void | adc_hal_set_reference_voltage_mode (uint32_t instance, adc_reference_voltage_mode_t mode) |
| Sets the selection of the reference voltage source. More... | |
| static void | adc_hal_configure_high_speed (uint32_t instance, bool isEnabled) |
| Switches the high speed mode on/off . More... | |
| static void | adc_hal_configure_long_sample (uint32_t instance, bool isEnabled) |
| Switch the long sample mode on/off. More... | |
| static void | adc_hal_set_long_sample_mode (uint32_t instance, adc_long_sample_mode_t mode) |
| Sets the selection of the long sample mode. More... | |
| static void | adc_hal_configure_low_power (uint32_t instance, bool isEnabled) |
| Switches the low power mode on/off. More... | |
| static void | adc_hal_set_resolution_mode (uint32_t instance, adc_resolution_mode_t mode) |
| Sets the selection of the resolution mode. More... | |
| static void | adc_hal_configure_continuous_conversion (uint32_t instance, bool isEnabled) |
| Switches the continuous conversion mode on/off. More... | |
| static void | adc_hal_configure_hw_trigger (uint32_t instance, bool isEnabled) |
| Switches the hardware trigger mode on/off . More... | |
| static void | adc_hal_configure_hw_average (uint32_t instance, bool isEnabled) |
| Switches the hardware average mode on/off. More... | |
| static void | adc_hal_set_hw_average_mode (uint32_t instance, adc_hw_average_mode_t mode) |
| Sets the selection of the hardware average mode. More... | |
| static void | adc_hal_configure_hw_compare (uint32_t instance, bool isEnabled) |
| Switches the hardware compare mode on/off. More... | |
| static void | adc_hal_configure_hw_compare_greater (uint32_t instance, bool isEnabled) |
| Switches the hardware compare greater configuration on/off . More... | |
| static void | adc_hal_configure_hw_compare_in_range (uint32_t instance, bool isEnabled) |
| Switches the hardware compare range configuration on/off . More... | |
| static void | adc_hal_set_hw_compare_value1 (uint32_t instance, uint32_t value) |
| Sets the value1 in the hardware compare. More... | |
| static void | adc_hal_set_hw_compare_value2 (uint32_t instance, uint32_t value) |
| Sets the value2 in the hardware compare. More... | |
| static void | adc_hal_configure_dma (uint32_t instance, bool isEnabled) |
| Switches the ADC DMA trigger on/off. More... | |
| static void | adc_hal_disable (uint32_t instance, uint32_t group) |
| Switches off the ADC channel conversion. More... | |
| static void | adc_hal_enable (uint32_t instance, uint32_t group, adc_channel_mode_t mode, bool isDifferential) |
| Sets the channel number and switches on the conversion. More... | |
| static void | adc_hal_configure_interrupt (uint32_t instance, uint32_t group, bool isEnabled) |
| Switches the ADC interrupt trigger on/off . More... | |
| static bool | adc_hal_is_in_process (uint32_t instance) |
| Checks whether the ADC is in process. More... | |
| static bool | adc_hal_is_conversion_completed (uint32_t instance, uint32_t group) |
| Checks whether the channel conversion is complete. More... | |
| static bool | adc_hal_is_calibration_fail (uint32_t instance) |
| Checks whether the calibration failed. More... | |
| static uint32_t | adc_hal_get_conversion_value (uint32_t instance, uint32_t group) |
| Gets the conversion value. More... | |
| static void | adc_hal_set_group_mux (uint32_t instance, adc_group_mux_mode_t group) |
| Sets the current group mux that executes the conversion. More... | |
| enum adc_group_mux_mode_t |
| enum adc_channel_mode_t |
| enum adc_status_t |
| adc_status_t adc_hal_start_calibration | ( | uint32_t | instance | ) |
This function clears the calibration flag bit and sets the enable bit to start the calibration.
| instance | ADC instance ID. |
|
inlinestatic |
This function clears the calibration enable bit to end the calibration.
| instance | ADC instance ID. |
| uint32_t adc_hal_get_calibration_PG | ( | uint32_t | instance | ) |
This function gets the CLP0 - CLP4 and CLPS, accumulates them, and returns the value that can be set to the PG directly.
| instance | ADC instance ID. |
|
inlinestatic |
This function sets the PG register directly.
| instance | ADC instance ID. |
| val | the value that can be set to PG directly. |
| uint32_t adc_hal_get_calibration_MG | ( | uint32_t | instance | ) |
This function gets the CLM0 - CLM4 and CLMS, accumulates them, and returns the value that can be set to the MG directly.
| instance | ADC instance ID. |
|
inlinestatic |
This function sets the MG register directly.
| instance | ADC instance ID. |
| val | the value that can be set to MG directly. |
|
inlinestatic |
If the user wants to adjust the offset value according to the application, the origin offset value will be a reference.
| instance | ADC instance ID. |
|
inlinestatic |
This function is to set the user selected or calibration generated offset error correction value. The value set here is subtracted from the conversion and the result is transferred into the result registers (Rn). If the result is above the maximum or below the minimum result value, it is forced to the appropriate limit for the current mode of operation.
| instance | ADC instance ID. |
| value | The manual offset value. |
|
inlinestatic |
The selection of ADC clock source can see to the type definition of adc_clock_source_mode_t. This function selects the input clock source to generate the internal clock, ADCK. Note that when the ADACK clock source is selected, it does not have to be activated prior to the start of the conversion. When it is selected and it is not activated prior to start a conversion , the asynchronous clock will be activated at the start of a conversion and shuts off when conversions are terminated. In this case, there is an associated clock startup delay each time the clock source is re-activated.
| instance | ADC instance ID. |
| mode | The indicated clock source mode. |
|
inlinestatic |
When enables the ADC's asynchronous clock source and the clock source output regardless of the conversion and input clock select status of the ADC. Based on MCU configuration, the asynchronous clock may be used by other modules. Setting this mode allows the clock to be used even while the ADC is idle or operating from a different clock source. Also, latency of initiating a single or first-continuous conversion with the asynchronous clock selected is reduced since the ADACK clock is already operational.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
The selection of ADC's clock divider can see to the type definition of the adc_clock_divider_mode_t. This function selects the divide ratio used by the ADC to generate the internal clock ADCK.
| instance | ADC instance ID. |
| mode | The selection of the divider. |
|
inlinestatic |
The selection of ADC's reference voltage can see to the type definition of adc_reference_voltage_mode_t. This function selects the voltage reference source used for conversions.
| instance | ADC instance ID. |
| mode | The selection of the reference voltage source. |
|
inlinestatic |
This function configures the ADC for high speed operations. The conversion sequence is altered (2 ADCK cycles added to the conversion time) to allow higher speed conversion clocks.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function selects between the different sample times based on the conversion mode selected. It adjusts the sample period to allow higher impedance inputs to be accurately sampled or to maximize conversion speed for lower impedance inputs. Longer sample times can also be used to lower overall power consumption if the continuous conversions are enabled and the high conversion rates are not required. In fact this will be able to charge the SAR in a timely manner way without affecting the SAR configuration.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
The selection of ADC long sample mode can see to the type definition of the adc_long_sample_mode_t. This function selects the long sample mode that indicating the different count of extra ADCK cycles are needed.
| instance | ADC instance ID. |
| mode | The selection of long sample mode. |
|
inlinestatic |
This function controls the power configuration of the successive approximation converter. This optimizes power consumption when higher sample rates are not required.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
The selection of ADC resolution mode can see to the type definition of the adc_resolution_mode_t. This function selects the ADC resolution mode. Note that the differential conversion is different to single-end conversion.
| instance | ADC instance ID. |
| mode | The selection of resolution mode. |
|
inlinestatic |
This function configures the continuous conversions or sets of conversions if the hardware average function is enabled after initiating a conversion.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function selects the type of trigger used for initiating a conversion. Two types of triggers can be selected: software trigger and hardware trigger. When software trigger is selected, a conversion is initiated following a write to SC1A. When hardware trigger is selected, a conversion is initiated following the assertion of the external events. The event will come through the signal on the line of ADHWT input after a pulse of ADHWTSn input inside SOC.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function enables the hardware average function of the ADC.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
The selection of ADC hardware average mode can see to the type definition of the adc_hw_average_mode_t. This function determines how many ADC conversions are averaged to create the ADC average result.
| instance | ADC instance ID. |
| mode | The selection of hardware average mode. |
|
inlinestatic |
This function enables the compare function.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function configures the compare function to check the conversion result relative to the compare value register(s) (CV1 and CV2). To enable will configure greater than or equal to threshold, outside range inclusive and inside range inclusive functionality based on the values placed in the CV1 and CV2 registers. Otherwise, it will configure less than threshold, outside range not inclusive and inside range not inclusive functionality based on the values placed in the CV1 and CV2 registers.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function configures the compare function to check if the conversion result of the input being monitored is either inside or outside the range formed by the compare value registers (CV1 and CV2). However, the actual compare range should be determined alone with the function of adc_hal_configure_hw_compare_greater() as well.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
This function sets the value of the CV1 register.
| instance | ADC instance ID. |
| value | The setting value. |
|
inlinestatic |
This function sets the value of the CV2 register.
| instance | ADC instance ID. |
| value | The setting value. |
|
inlinestatic |
When DMA is enabled, it asserts the ADC DMA request during the ADC conversion complete event noted by the assertion of any of the ADC COCO flags.
| instance | ADC instance ID. |
| isEnabled | The switcher. |
|
inlinestatic |
Here the "NUll" channel is set to the conversion channel.
| instance | ADC instance ID. |
| group | The group mux index. |
|
inlinestatic |
When the available channel is set, the conversion begins to execute.
| instance | ADC instance ID. |
| group | The group mux index. |
| mode | The selection of channel number. |
| isDifferential | the selection of differential input. |
|
inlinestatic |
This function enables conversion complete interrupts. When COCO is set while the respective AIEN is high, an interrupt is asserted.
| instance | ADC instance ID. |
| group | The group mux index. |
| inEnable | The switcher. |
|
inlinestatic |
This function indicates that a conversion or hardware averaging is in progress. ADACT is set when a conversion is initiated and cleared when a conversion is completed or aborted. Note that if the continuous conversion is been use, this function will always return true.
| instance | ADC instance ID. |
|
inlinestatic |
This function indicates whether each conversion is completed.
| instance | ADC instance ID. |
| group | The grout mux index. |
|
inlinestatic |
This function displays the result of the calibration sequence.
| instance | ADC instance ID. |
|
inlinestatic |
This function returns the conversion value kept in the Rn Register. Unused bits in the Rn register are cleared in unsigned right justified modes and carry the sign bit (MSB) in sign extended 2's complement modes.
| instance | ADC instance ID. |
| group | The group mux index. |
|
inlinestatic |
ADC Mux select bit changes the ADC group setting to select between alternate sets of ADC channels. It will activate group A or group B.
| instance | ADC instance ID. |
| group | The group mux index. |